package com.duobaoyu.dby.supply.api.controller;

import com.duobaoyu.dby.common.core.util.R;
import com.duobaoyu.dby.common.security.annotation.Inner;
import com.duobaoyu.dby.supply.api.service.LogisticsBizService;
import com.duobaoyu.dby.supply.common.biz.remote.dto.order.OrderDeliveryDTO;
import com.duobaoyu.dby.supply.common.biz.remote.to.order.DeliveryTO;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 物流controller
 *
 * @Author yangyong
 * @Date 2023/9/27
 */
@Inner
@Validated
@RestController
@RequestMapping("/api/logistics")
@RequiredArgsConstructor
public class LogisticsController{

	private final LogisticsBizService logisticsBizService;

	/**
	 * 获取订单配送信息
	 *
	 * @param orderDelivery 查询条件
	 * @return R<List < DeliveryTO>>
	 */
	@PostMapping("/order")
	public R<List<DeliveryTO>> getOrderDelivery(@Valid @RequestBody OrderDeliveryDTO orderDelivery) {
		return R.ok(logisticsBizService.getOrderDelivery(orderDelivery));
	}
}
